<?php
class GuestbookModel extends Model {
	protected $_validate = array(
	    array('title','require','请填写标题！'),
		array('yourname','require','请填写您的姓名！'),
		array('tel','require','请填写您的联系电话！'),
		array('e-mail','email','请填写正确的电子邮箱！'),
    );
	protected $_auto = array(
        array('datetime','time',1,'function'),
    );
	
	public function _list($view,$map,$sort='sort',$pagesize=20){
		//计算总页数
		$count=$this->where($map)->count();
		//实例化分页类
		import ( 'ORG.Util.Page' );
		$p=new Page($count,$pagesize);
		$list = $this->where($map)->order($sort)->limit($p->firstRow.',
'.$p->listRows)->select();
        $pages=$p->show();
		$view->assign('list',$list);
		$view->assign('pages',$pages);
	}
}

?>